package org.hackystat.sdsa.analyzer.control.compressor;

import java.util.ArrayList;
import java.util.List;

import org.hackystat.sdsa.analyzer.SdsaAnalyzerException;
import org.hackystat.sdsa.analyzer.model.activity.Activity;

/**
 * CompressorHolder is a container for all compressors.
 * 
 * @author hongbing
 *
 */
public class CompressorContainer {
  /** List of comprressors. */
  private List<Compressor> compressors = new ArrayList<Compressor>();
  
  /**
   * Adds a compressor to the container. 
   * 
   * @param compressor A new compressor.
   */
  public void addCompressor(Compressor compressor) {
    compressors.add(compressor);
  }
  
  /**
   * Compresses the list of activities using the pre-defined compressors.
   * 
   * @param activityList A list of activities.
   * @throws SdsaAnalyzerException If problem occurs.
   */
  public void compress(List<Activity> activityList) throws SdsaAnalyzerException {
     for (Compressor compressor : this.compressors) {
       compressor.compress(activityList);
     }
  }
}
